/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JPanelFormularioGeneral.java
 *
 * Created on 21-nov-2011, 10:39:23
 */
package androidutal;

import com.toedter.calendar.JDateChooser;
import java.awt.BorderLayout;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

/**
 *
 * @author blackmoon
 */
public class JPanelOfertaPractica extends javax.swing.JPanel {
    private final JVentana ventana;
    private  String[] profesores;
    private File file;
    private String fechaInicio;
    private String fechaFin;
    private boolean isBorrador;
    private  Date date;
    
    /** Creates new form JPanelFormularioGeneral */
    public JPanelOfertaPractica(JVentana ventana) {
        Datos datos;  
        file=null;
        try {
            datos = new Datos();
            this.profesores= datos.getProfe();
        } catch (FileNotFoundException ex) {
            Logger.getLogger(JPanelOfertaPractica.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(JPanelOfertaPractica.class.getName()).log(Level.SEVERE, null, ex);
        }
        initComponents();
        this.ventana = ventana;
        this.isBorrador = false;
        this.date=new Date();
        this.jFechaInicio.setDate(this.date);
        this.jFechaFin.setDate(this.date) ;
    }
    public boolean isBorrador() {
        return isBorrador;
    }
    public void setIsBorrador(boolean isBorrador) {
        this.isBorrador = isBorrador;
    }
    public String getFechaFin() {
        return fechaFin;
    }

    public void setFechaFin(String fechaFin) {
        this.fechaFin = fechaFin;
    }

    public String getFechaInicio() {
        return fechaInicio;
    }

    public void setFechaInicio(String fechaInicio) {
        this.fechaInicio = fechaInicio;
    }

    public File getFile() {
        return file;
    }

    public void setFile(File file) {
        this.file = file;
    }

    public JTextField getjAdjunto() {
        return jAdjunto;
    }

    public void setjAdjunto(JTextField jAdjunto) {
        this.jAdjunto = jAdjunto;
    }

    public JTextField getjContacto() {
        return jContacto;
    }

    public void setjContacto(JTextField jContacto) {
        this.jContacto = jContacto;
    }

    public JTextField getjDuracion() {
        return jDuracion;
    }

    public void setjDuracion(JTextField jDuracion) {
        this.jDuracion = jDuracion;
    }

    public JDateChooser getjFechaFin() {
        return jFechaFin;
    }

    public void setjFechaFin(String FechaFin) {
        this.jFechaFin.setDate(new Date(FechaFin));
    }

    public JDateChooser getjFechaInicio() {
        return jFechaInicio;
    }

    public void setjFechaInicio(String FechaInicio) {
        this.jFechaInicio.setDate(new Date(FechaInicio));
    }

    public JTextField getjHoras() {
        return jHoras;
    }

    public void setjHoras(JTextField jHoras) {
        this.jHoras = jHoras;
    }

    public JTextField getjLugar() {
        return jLugar;
    }

    public void setjLugar(JTextField jLugar) {
        this.jLugar = jLugar;
    }

    public JTextArea getjObservaciones() {
        return jObservaciones;
    }

    public void setjObservaciones(JTextArea jObservaciones) {
        this.jObservaciones = jObservaciones;
    }

    public JComboBox getjProfesores1() {
        return jProfesores1;
    }

    public void setjProfesores1(JComboBox jProfesores1) {
        this.jProfesores1 = jProfesores1;
    }

    public JTextArea getjRequisitos() {
        return jRequisitos;
    }

    public void setjRequisitos(JTextArea jRequisitos) {
        this.jRequisitos = jRequisitos;
    }

    public JTextField getjSueldo() {
        return jSueldo;
    }

    public void setjSueldo(JTextField jSueldo) {
        this.jSueldo = jSueldo;
    }

    public JTextField getjTitulo() {
        return jTitulo;
    }

    public void setjTitulo(JTextField jTitulo) {
        this.jTitulo = jTitulo;
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jTitulo = new javax.swing.JTextField();
        jAdjunto = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        jObservaciones = new javax.swing.JTextArea();
        jLabel4 = new javax.swing.JLabel();
        jButton4 = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLugar = new javax.swing.JTextField();
        jContacto = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jDuracion = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jSueldo = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jRequisitos = new javax.swing.JTextArea();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jFechaInicio = new com.toedter.calendar.JDateChooser();
        jFechaFin = new com.toedter.calendar.JDateChooser();
        jHoras = new javax.swing.JTextField(new Integer(3));
        jButton5 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jProfesores1 = new javax.swing.JComboBox(this.profesores);

        setBackground(java.awt.Color.black);
        setMinimumSize(new java.awt.Dimension(454, 386));
        setPreferredSize(new java.awt.Dimension(454, 386));

        jLabel1.setBackground(java.awt.Color.black);
        jLabel1.setForeground(java.awt.Color.white);
        jLabel1.setText("Titulo:");

        jLabel3.setBackground(java.awt.Color.black);
        jLabel3.setForeground(java.awt.Color.white);
        jLabel3.setText("Observaciones:");

        jTitulo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTituloActionPerformed(evt);
            }
        });

        jAdjunto.setEditable(false);

        jObservaciones.setColumns(20);
        jObservaciones.setLineWrap(true);
        jObservaciones.setRows(5);
        jObservaciones.setWrapStyleWord(true);
        jScrollPane1.setViewportView(jObservaciones);

        jLabel4.setForeground(new java.awt.Color(255, 255, 255));
        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel4.setText("Oferta Laboral (Memorias/Practicas)");

        jButton4.setBackground(java.awt.Color.white);
        jButton4.setText("Adjuntar");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jLabel5.setBackground(java.awt.Color.black);
        jLabel5.setForeground(java.awt.Color.white);
        jLabel5.setText("Profesor:");

        jLabel6.setBackground(java.awt.Color.black);
        jLabel6.setForeground(java.awt.Color.white);
        jLabel6.setText("Lugar de trabajo:");

        jLugar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jLugarActionPerformed(evt);
            }
        });

        jContacto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jContactoActionPerformed(evt);
            }
        });

        jLabel7.setBackground(java.awt.Color.black);
        jLabel7.setForeground(java.awt.Color.white);
        jLabel7.setText("Contacto:");

        jLabel8.setBackground(java.awt.Color.black);
        jLabel8.setForeground(java.awt.Color.white);
        jLabel8.setText("Horas semanales:");

        jDuracion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jDuracionActionPerformed(evt);
            }
        });

        jLabel9.setBackground(java.awt.Color.black);
        jLabel9.setForeground(java.awt.Color.white);
        jLabel9.setText("Duración:");

        jSueldo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jSueldoActionPerformed(evt);
            }
        });

        jLabel10.setBackground(java.awt.Color.black);
        jLabel10.setForeground(java.awt.Color.white);
        jLabel10.setText("Sueldo:");

        jLabel11.setBackground(java.awt.Color.black);
        jLabel11.setForeground(java.awt.Color.white);
        jLabel11.setText("Requisitos:");

        jRequisitos.setColumns(20);
        jRequisitos.setLineWrap(true);
        jRequisitos.setRows(5);
        jRequisitos.setWrapStyleWord(true);
        jScrollPane2.setViewportView(jRequisitos);

        jLabel12.setBackground(java.awt.Color.black);
        jLabel12.setForeground(java.awt.Color.white);
        jLabel12.setText("Fecha Desde:");

        jLabel13.setBackground(java.awt.Color.black);
        jLabel13.setForeground(java.awt.Color.white);
        jLabel13.setText("Hasta:");

        jPanel1.setBackground(java.awt.Color.black);

        jButton1.setBackground(java.awt.Color.white);
        jButton1.setText("Publicar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setBackground(java.awt.Color.white);
        jButton2.setText("Borrador");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton3.setBackground(java.awt.Color.white);
        jButton3.setText("Cancelar");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addComponent(jButton2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 197, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addGap(28, 28, 28)
                .addComponent(jButton3))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
                    .addComponent(jButton3)
                    .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        jHoras.setEditable(false);
        jHoras.setText("0");

        jButton5.setText("+");
        jButton5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jButton5MouseEntered(evt);
            }
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jButton5MousePressed(evt);
            }
        });
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jButton6.setText("-");
        jButton6.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jButton6MousePressed(evt);
            }
        });
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        jProfesores1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jProfesores1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 434, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jLabel5)
                            .addComponent(jLabel7)
                            .addComponent(jLabel6)
                            .addComponent(jLabel8)
                            .addComponent(jButton4)
                            .addComponent(jLabel12)
                            .addComponent(jLabel11)
                            .addComponent(jLabel3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
                            .addComponent(jLugar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
                            .addComponent(jTitulo, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
                            .addComponent(jContacto, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jAdjunto, javax.swing.GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE)
                                    .addComponent(jFechaInicio, javax.swing.GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jHoras, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jButton5)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jButton6)
                                        .addGap(5, 5, 5)))
                                .addGap(13, 13, 13)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel9)
                                            .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(18, 18, 18))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jFechaFin, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
                                    .addComponent(jSueldo, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
                                    .addComponent(jDuracion, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)))
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
                            .addComponent(jProfesores1, 0, 328, Short.MAX_VALUE))
                        .addGap(27, 27, 27))
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(21, 21, 21)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel5)
                    .addComponent(jProfesores1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLugar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7)
                    .addComponent(jContacto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel8)
                        .addComponent(jHoras, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButton5)
                        .addComponent(jButton6))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jDuracion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel9))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jSueldo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel10)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jAdjunto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton4))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel12)
                    .addComponent(jFechaInicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jFechaFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel11)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 49, Short.MAX_VALUE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(13, 13, 13)
                        .addComponent(jLabel3))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
    }// </editor-fold>//GEN-END:initComponents

private void jTituloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTituloActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTituloActionPerformed

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
// TODO add your handling code here:
    final JFileChooser fc = new JFileChooser();
     
     int result= fc.showOpenDialog(this);
     fc.setVisible(true);
     if (result==JFileChooser.APPROVE_OPTION)
     {
        file = fc.getSelectedFile();
        this.jAdjunto.setText(file.getPath());
     }
}//GEN-LAST:event_jButton4ActionPerformed

private void jLugarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jLugarActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jLugarActionPerformed

private void jContactoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jContactoActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jContactoActionPerformed

private void jDuracionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jDuracionActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jDuracionActionPerformed

private void jSueldoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jSueldoActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jSueldoActionPerformed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
    if(jFechaInicio.getDate() != null && jFechaFin.getDate() != null && !jTitulo.getText().equals("")&&  !jLugar.getText().equals("") && !jContacto.getText().equals("") 
      && !jDuracion.getText().equals("") && file!= null && !jRequisitos.getText().equals("") &&  !jObservaciones.getText().equals("") && !jSueldo.getText().equals("")
      && !jHoras.getText().equals("0")){
         if(this.isBorrador)
               this.ventana.getResumen().eliminarFila(); 
        fechaInicio = new SimpleDateFormat("MM/dd/yyyy").format(this.jFechaInicio.getDate()); 
        fechaFin = new SimpleDateFormat("MM/dd/yyyy").format(this.jFechaFin.getDate()); 
        ventana.getBaseDeDatos().addMemoriaPractica(jTitulo.getText(), (String)jProfesores1.getSelectedItem(), 
                jLugar.getText(), jContacto.getText(), Integer.valueOf(jHoras.getText()), jDuracion.getText(), file, 
                jSueldo.getText(), fechaInicio, fechaFin, jRequisitos.getText(),jObservaciones.getText(),false,this.ventana.getConfiguracionSubeYBaja().generaUrl(file.getName()));
        Date date=new Date();
        ventana.getResumen().insertarInfo((String)this.jTitulo.getText(),date.toString(),"No" );
        this.setVisible(false);
        ventana.add(ventana.getResumen(),BorderLayout.CENTER);
        ventana.getResumen().setVisible(true);
        ventana.save();
        ventana.saveToWS();
        ventana.subirFTP(file);
    }
    else{
        JOptionPane.showMessageDialog(this, "Rellene todos los campos obligatorios");
    }
}//GEN-LAST:event_jButton1ActionPerformed

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
    if(this.isBorrador()){
        this.jButton2ActionPerformed(evt);
        this.ventana.getResumen().eliminarFila();
        if(jFechaInicio.getDate() != null && jFechaFin.getDate() != null ){
            this.setVisible(false);
            ventana.add(ventana.getResumen(),BorderLayout.CENTER);
            ventana.getResumen().setVisible(true); 
        }
    }
    else{
        this.setVisible(false);
        ventana.add(ventana.getResumen(),BorderLayout.CENTER);
        ventana.getResumen().setVisible(true); 
    }
    this.desbloquear();
}//GEN-LAST:event_jButton3ActionPerformed

private void jButton5MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton5MouseEntered
// TODO add your handling code here:
   
}//GEN-LAST:event_jButton5MouseEntered

private void jButton5MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton5MousePressed
// TODO add your handling code here:
    
  
    
}//GEN-LAST:event_jButton5MousePressed

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
// TODO add your handling code here:
    int horas =Integer.parseInt(jHoras.getText());
    horas+=1;
    this.jHoras.setText(String.valueOf(horas)); 
    
}//GEN-LAST:event_jButton5ActionPerformed

private void jButton6MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton6MousePressed
// TODO add your handling code here:
    int horas =Integer.parseInt(jHoras.getText());
    if (horas>0)
    {
        horas-=1;
        this.jHoras.setText(String.valueOf(horas));
    }
    
    
}//GEN-LAST:event_jButton6MousePressed

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
// TODO add your handling code here:
    
}//GEN-LAST:event_jButton6ActionPerformed

private void jProfesores1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jProfesores1ActionPerformed
// TODO add your handling code here:
    
}//GEN-LAST:event_jProfesores1ActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
        fechaInicio = new SimpleDateFormat("MM/dd/yyyy").format(this.jFechaInicio.getDate()); 
        fechaFin = new SimpleDateFormat("MM/dd/yyyy").format(this.jFechaFin.getDate());
        if(file !=null)
         ventana.getBaseDeDatos().addMemoriaPractica(jTitulo.getText(), (String)jProfesores1.getSelectedItem(), 
                jLugar.getText(), jContacto.getText(), Integer.valueOf(jHoras.getText()), jDuracion.getText(), file, 
                jSueldo.getText(), fechaInicio, fechaFin, jRequisitos.getText(),jObservaciones.getText(),true,this.ventana.getConfiguracionSubeYBaja().generaUrl(file.getName()));
        else
            ventana.getBaseDeDatos().addMemoriaPractica(jTitulo.getText(), (String)jProfesores1.getSelectedItem(), 
                jLugar.getText(), jContacto.getText(), Integer.valueOf(jHoras.getText()), jDuracion.getText(), file, 
                jSueldo.getText(), fechaInicio, fechaFin, jRequisitos.getText(),jObservaciones.getText(),true,"");
        Date date=new Date();
        ventana.getResumen().insertarInfo((String)this.jTitulo.getText(),this.date.toString() ,"Si");
        this.setVisible(false);
        ventana.add(ventana.getResumen(),BorderLayout.CENTER);
        ventana.getResumen().setVisible(true);
    ventana.save();
}//GEN-LAST:event_jButton2ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField jAdjunto;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JTextField jContacto;
    private javax.swing.JTextField jDuracion;
    private com.toedter.calendar.JDateChooser jFechaFin;
    private com.toedter.calendar.JDateChooser jFechaInicio;
    private javax.swing.JTextField jHoras;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JTextField jLugar;
    private javax.swing.JTextArea jObservaciones;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JComboBox jProfesores1;
    private javax.swing.JTextArea jRequisitos;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTextField jSueldo;
    private javax.swing.JTextField jTitulo;
    // End of variables declaration//GEN-END:variables
    public void bloquear(){
        this.getjTitulo().setEditable(false);
        this.getjAdjunto().setEditable(false);
        this.getjFechaFin().setEnabled(false);
        this.getjFechaInicio().setEnabled(false);
        this.getjObservaciones().setEditable(false);
        this.getjRequisitos().setEditable(false);
        this.getjContacto().setEditable(false);
        this.getjDuracion().setEditable(false);
        this.getjHoras().setEditable(false);
        this.getjLugar().setEditable(false);
        this.getjProfesores1().setEnabled(false);
        this.getjSueldo().setEditable(false);
        this.jButton1.setVisible(false);
        this.jButton2.setVisible(false);
        this.jButton4.setVisible(false);
        this.jButton5.setVisible(false);
        this.jButton6.setVisible(false);
    }
    public void desbloquear(){
        this.getjTitulo().setEditable(true);
        this.getjAdjunto().setEditable(true);
        this.getjFechaFin().setEnabled(true);
        this.getjFechaInicio().setEnabled(true);
        this.getjObservaciones().setEditable(true);
        this.getjRequisitos().setEditable(true);
        this.getjContacto().setEditable(true);
        this.getjDuracion().setEditable(true);
        this.getjHoras().setEditable(true);
        this.getjLugar().setEditable(true);
        this.getjProfesores1().setEnabled(true);
        this.getjSueldo().setEditable(true);
        this.jButton1.setVisible(true);
        this.jButton2.setVisible(true);
        this.jButton4.setVisible(true);
        this.jButton5.setVisible(true);
        this.jButton6.setVisible(true);
    }
}
